// window.ailin_native_praise_Dialog_Prefab = function () {
//     var e = !0;
//     var t = 5 * ailin.Props_Base_Gold;
//     var o = new cc.Node();
//     var i = new cc.Node();
//     o.addChild(i);
//     i.addComponent(cc.BlockInputEvents);
//     i.addComponent(cc.Sprite);
//     i.opacity = 50;
//     ailin_load("q_ad/oppo_native_insters_layerBg.png", function (e, t) {
//         i.getComponent(cc.Sprite).spriteFrame = new cc.SpriteFrame(t);
//         i.getComponent(cc.Sprite).sizeMode = cc.Sprite.SizeMode.CUSTOM;
//         i.width = cc.winSize.width;
//         i.height = cc.winSize.height;
//     });
//     var n = new cc.Node();
//     o.scale = ailin_sdk_manager._SceneScale;
//     i.scale = 1 / ailin_sdk_manager._SceneScale;
//     o.addChild(n);
//     n.addComponent(cc.Sprite);
//     ailin_load("native/home_15.png", function (e, t) {
//         n.getComponent(cc.Sprite).spriteFrame = new cc.SpriteFrame(t);
//         n.height = 620;
//     });
//     if (cc.winSize.height < 720) {
//         n.scale = cc.winSize.height / 720;
//     }
//     var a = new cc.Node();
//     n.addChild(a);
//     a.x = 0;
//     a.y = -234;
//     a.addComponent(cc.Sprite);
//     ailin_load("native/home_13.png", function (e, t) {
//         a.getComponent(cc.Sprite).spriteFrame = new cc.SpriteFrame(t);
//     });
//     var s = new cc.Node();
//     a.addChild(s);
//     ailin_load("native/pingjia_1.png", function (e, t) {
//         s.addComponent(cc.Sprite).spriteFrame = new cc.SpriteFrame(t);
//     });
//     var r = new cc.Node();
//     n.addChild(r);
//     r.x = 219;
//     r.y = 242;
//     r.addComponent(cc.Sprite);
//     ailin_load("native/home_12.png", function (e, t) {
//         r.getComponent(cc.Sprite).spriteFrame = new cc.SpriteFrame(t);
//     });
//     r.on(cc.Node.EventType.TOUCH_START, function () {
//         if (e) {
//             o.destroy();
//         }
//     });
//     a.on(cc.Node.EventType.TOUCH_START, function () {
//         if (e) {
//             e = !1;
//             user_default.set_bool_for_key("alreadyPraise", !0);
//             1 == ailin_sdk_manager.huoqu_xitong_pingtai()
//                 ? ailin_sdk_manager.diaoyongAnzhuoJiekou(ACTION_RATE)
//                 : 14 == ailin_sdk_manager.huoqu_xitong_pingtai() && jsb.reflection.callStaticMethod("MyManager", "xianshiPingfen");
//             o.runAction(
//                 cc.sequence(
//                     cc.delayTime(0.1),
//                     cc.callFunc(function () {
//                         var e = user_default.get_int_for_key(ailin.Key_Gold) + t;
//                         user_default.set_data_for_key(ailin.Key_Gold, e);
//                         o.destroy();
//                         cc.systemEvent.emit("lieyou_addGoldKey", t);
//                     })
//                 )
//             );
//         }
//     });
//     var c = new cc.Node();
//     c.color = cc.color(255, 255, 255);
//     c.width = 500;
//     c.y = 254;
//     c.x = 0;
//     n.addChild(c);
//     var l = c.addComponent(cc.Label);
//     l.fontSize = 40;
//     l.horizontalAlign = cc.Label.HorizontalAlign.CENTER;
//     l.overflow = cc.Label.Overflow.RESIZE_HEIGHT;
//     l.verticalAlign = cc.Label.VerticalAlign.BOTTOM;
//     l.string = tips_str.getPraiseTitle();
//     var d = new cc.Node();
//     d.color = cc.color(0, 0, 0);
//     d.width = 550;
//     n.addChild(d);
//     d.y = -96;
//     var u = d.addComponent(cc.Label);
//     u.fontSize = 30;
//     u.lineHeigth = 30;
//     u.horizontalAlign = cc.Label.HorizontalAlign.CENTER;
//     u.overflow = cc.Label.Overflow.RESIZE_HEIGHT;
//     u.verticalAlign = cc.Label.VerticalAlign.BOTTOM;
//     u.string = tips_str.getPraiseString();
//     var h = new cc.Node();
//     h.x = -192;
//     h.y = 46;
//     ailin_load("native/pingjia_0.png", function (e, t) {
//         h.addComponent(cc.Sprite).spriteFrame = new cc.SpriteFrame(t);
//     });
//     var p = new cc.Node();
//     p.x = -96;
//     p.y = 62;
//     ailin_load("native/pingjia_0.png", function (e, t) {
//         p.addComponent(cc.Sprite).spriteFrame = new cc.SpriteFrame(t);
//     });
//     var g = new cc.Node();
//     g.x = 0;
//     g.y = 73;
//     ailin_load("native/pingjia_0.png", function (e, t) {
//         g.addComponent(cc.Sprite).spriteFrame = new cc.SpriteFrame(t);
//     });
//     var f = new cc.Node();
//     f.x = 96;
//     f.y = 62;
//     ailin_load("native/pingjia_0.png", function (e, t) {
//         f.addComponent(cc.Sprite).spriteFrame = new cc.SpriteFrame(t);
//     });
//     var m = new cc.Node();
//     m.x = 192;
//     m.y = 46;
//     ailin_load("native/pingjia_0.png", function (e, t) {
//         m.addComponent(cc.Sprite).spriteFrame = new cc.SpriteFrame(t);
//     });
//     n.addChild(h);
//     n.addChild(p);
//     n.addChild(g);
//     n.addChild(f);
//     n.addChild(m);
//     return o;
// };


/**
 * 创建并显示点赞对话框的函数
 * @returns {cc.Node} 返回一个包含点赞对话框的节点
 */
window.ailin_native_praise_Dialog_Prefab = function () {
    let canPraise = true;
    const goldReward = 5 * ailin.Props_Base_Gold;
    
    // 创建并配置背景节点
    const backgroundNode = new cc.Node();
    const inputBlockerNode = new cc.Node();
    backgroundNode.addChild(inputBlockerNode);
    inputBlockerNode.addComponent(cc.BlockInputEvents);
    inputBlockerNode.addComponent(cc.Sprite);
    inputBlockerNode.opacity = 50;

    // 加载背景图片
    ailin_load("q_ad/oppo_native_insters_layerBg.png", (err, texture) => {
        const sprite = inputBlockerNode.getComponent(cc.Sprite);
        sprite.spriteFrame = new cc.SpriteFrame(texture);
        sprite.sizeMode = cc.Sprite.SizeMode.CUSTOM;
        inputBlockerNode.width = cc.winSize.width;
        inputBlockerNode.height = cc.winSize.height;
    });

    // 创建内容节点
    const contentNode = new cc.Node();
    backgroundNode.scale = ailin_sdk_manager._SceneScale;
    inputBlockerNode.scale = 1 / ailin_sdk_manager._SceneScale;
    backgroundNode.addChild(contentNode);
    contentNode.addComponent(cc.Sprite);

    // 加载内容背景图片
    ailin_load("native/home_15.png", (err, texture) => {
        const sprite = contentNode.getComponent(cc.Sprite);
        sprite.spriteFrame = new cc.SpriteFrame(texture);
        contentNode.height = 620;
    });

    // 根据屏幕高度调整内容节点缩放
    if (cc.winSize.height < 720) {
        contentNode.scale = cc.winSize.height / 720;
    }

    // 创建并配置点赞按钮节点
    const praiseButtonNode = new cc.Node();
    contentNode.addChild(praiseButtonNode);
    praiseButtonNode.x = 0;
    praiseButtonNode.y = -234;
    praiseButtonNode.addComponent(cc.Sprite);

    // 加载点赞按钮图片
    ailin_load("native/home_13.png", (err, texture) => {
        praiseButtonNode.getComponent(cc.Sprite).spriteFrame = new cc.SpriteFrame(texture);
    });

    // 创建并配置点赞星星节点
    const starNode = new cc.Node();
    praiseButtonNode.addChild(starNode);
    ailin_load("native/pingjia_1.png", (err, texture) => {
        starNode.addComponent(cc.Sprite).spriteFrame = new cc.SpriteFrame(texture);
    });

    // 创建并配置关闭按钮节点
    const closeButtonNode = new cc.Node();
    contentNode.addChild(closeButtonNode);
    closeButtonNode.x = 219;
    closeButtonNode.y = 242;
    closeButtonNode.addComponent(cc.Sprite);

    // 加载关闭按钮图片
    ailin_load("native/home_12.png", (err, texture) => {
        closeButtonNode.getComponent(cc.Sprite).spriteFrame = new cc.SpriteFrame(texture);
    });

    // 绑定关闭按钮点击事件
    closeButtonNode.on(cc.Node.EventType.TOUCH_START, () => {
        if (canPraise) {
            backgroundNode.destroy();
        }
    });

    // 绑定点赞按钮点击事件
    praiseButtonNode.on(cc.Node.EventType.TOUCH_START, () => {
        if (canPraise) {
            canPraise = false;
            user_default.set_bool_for_key("alreadyPraise", true);

            if (ailin_sdk_manager.huoqu_xitong_pingtai() === 1) {
                ailin_sdk_manager.diaoyongAnzhuoJiekou(ACTION_RATE);
            } else if (ailin_sdk_manager.huoqu_xitong_pingtai() === 14) {
                jsb.reflection.callStaticMethod("MyManager", "xianshiPingfen");
            }

            backgroundNode.runAction(
                cc.sequence(
                    cc.delayTime(0.1),
                    cc.callFunc(() => {
                        const newGoldAmount = user_default.get_int_for_key(ailin.Key_Gold) + goldReward;
                        user_default.set_data_for_key(ailin.Key_Gold, newGoldAmount);
                        backgroundNode.destroy();
                        cc.systemEvent.emit("lieyou_addGoldKey", goldReward);
                    })
                )
            );
        }
    });

    // 创建并配置标题节点
    const titleNode = new cc.Node();
    titleNode.color = cc.color(255, 255, 255);
    titleNode.width = 500;
    titleNode.y = 254;
    titleNode.x = 0;
    contentNode.addChild(titleNode);
    const titleLabel = titleNode.addComponent(cc.Label);
    titleLabel.fontSize = 40;
    titleLabel.horizontalAlign = cc.Label.HorizontalAlign.CENTER;
    titleLabel.overflow = cc.Label.Overflow.RESIZE_HEIGHT;
    titleLabel.verticalAlign = cc.Label.VerticalAlign.BOTTOM;
    titleLabel.string = tips_str.getPraiseTitle();

    // 创建并配置描述节点
    const descriptionNode = new cc.Node();
    descriptionNode.color = cc.color(0, 0, 0);
    descriptionNode.width = 550;
    contentNode.addChild(descriptionNode);
    descriptionNode.y = -96;
    const descriptionLabel = descriptionNode.addComponent(cc.Label);
    descriptionLabel.fontSize = 30;
    descriptionLabel.lineHeight = 30;
    descriptionLabel.horizontalAlign = cc.Label.HorizontalAlign.CENTER;
    descriptionLabel.overflow = cc.Label.Overflow.RESIZE_HEIGHT;
    descriptionLabel.verticalAlign = cc.Label.VerticalAlign.BOTTOM;
    descriptionLabel.string = tips_str.getPraiseString();

    // 创建并配置五星节点
    const starPositions = [
        { x: -192, y: 46 },
        { x: -96, y: 62 },
        { x: 0, y: 73 },
        { x: 96, y: 62 },
        { x: 192, y: 46 },
    ];
    starPositions.forEach((pos) => {
        const starNode = new cc.Node();
        starNode.x = pos.x;
        starNode.y = pos.y;
        ailin_load("native/pingjia_0.png", (err, texture) => {
            starNode.addComponent(cc.Sprite).spriteFrame = new cc.SpriteFrame(texture);
        });
        contentNode.addChild(starNode);
    });

    return backgroundNode;
};
